package com.springboot.controller;

import com.springboot.entity.User;
import com.springboot.repository.UserRepository;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserRepository userRepository;

    @GetMapping("/findAll")
    public List<User> findAll(){
        List<User> userList = userRepository.findAll();
        return userList;
    }
}
